package org.budo.dubbo.protocol.http.view.util;

import lombok.extern.slf4j.Slf4j;

/**
 * @author lmw
 */
@Slf4j
public class ViewRenderUtil {
    public static String forbidAccessService(Throwable e) {
        String error = e + "";

        String from = " access service ";
        int a = error.indexOf(from);
        if (a < 0) {
            log.error("#17 a=" + a + ", error=" + error);
            return "forbidAccessService-18";
        }

        String to = " from registry ";
        int b = error.indexOf(to, a);
        if (b < 0) {
            log.error("#24 b=" + b + ", a=" + a + ", error=" + error);
            return "forbidAccessService-25";
        }

        return error.substring(a + from.length(), b);
    }
}